package com.tencent.trtcsimpledemo;

import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import com.tencent.live.LiveRoomListActivity;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        getSupportActionBar().hide();
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                findViewById(R.id.launch_view).setVisibility(View.GONE);
            }
        },1000);

        findViewById(R.id.bt_live).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(MainActivity.this, LiveRoomListActivity.class);
                startActivity(intent);
            }
        });
    }


    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {

        Log.i("yjj", "onKeyDown >>>keyCode" + keyCode + ", action =" + event.getAction());
        if (keyCode == 66) {
            gotoLiveRoom();
        }

        return super.onKeyDown(keyCode, event);
    }

    private void gotoLiveRoom() {
        Intent intent = new Intent(MainActivity.this, LiveRoomListActivity.class);
        startActivity(intent);
    }
}
